<template>
    <div class="bargain">
        <yx-header>
            <template #left>
               <van-icon name="arrow-left" @click="$router.go(-1)"/>
            </template>
            <template #center>
               砍价列表
            </template>
        </yx-header>
        <ul class="bargain-ul">
            <!-- v-for可以循环遍历对象  item地对象的属性值 index 是对象的属性名 -->
            <li v-for="(item,index) in goodsMap" :key="index">
                <img :src="item.pic" alt="">
                <div>
                    <h4>{{item.name}}</h4>
                    <p>{{item.characteristic}}</p>
                    <ol>
                        <li>
                            <p>￥{{item.minPrice}}</p>
                            <p>低价</p>
                        </li>
                        <li>
                            <p>￥{{item.originalPrice}}</p>
                            <p>原价</p>
                        </li>
                        <li>
                            <p>{{item.stores}}</p>
                            <p>限量</p>
                        </li>
                    </ol>
                </div>
            </li>
        </ul>
    </div>
</template>
<script>
import {getBargainList} from '@/utils/second.js'
import {reactive,toRefs} from 'vue'
import yxHeader from '@/components/yxHeader'
export default {
    setup(props) {
        const data = reactive({
            goodsMap:{},//存放砍价
            obj:{
                name:'zs',
                age:18,
                sex:'男'
            }
        })
        
        getBargainList().then(res=>{
            console.log(res);
            data.goodsMap = res.data.goodsMap

        })
        return {...toRefs(data)}
    },
    components:{
        yxHeader
    }
}
</script>
<style lang="scss" scoped>
.bargain{
    font-size: 16px;
}
.bargain-ul{
    li{
        display: flex;
        padding: 10px;
         img{
        width:114px;
        height: 114px;
       }
       div{
        margin-left: 10px;
          h4{
            font-size: 14px;
            margin-bottom: 10px;

          }
          p{
            font-size: 12px;
            color: #999;
          }
          ol{
              display: flex;
              margin-top: 20px;
            li{
                display: flex;
                flex-direction: column;
                align-items: center;
                 justify-content: space-around;
                 margin-right: 30px;
                padding: 0;
                p{
                    height: 20px;
                }
            }
          }
       }
    }
   
}
</style>
